package edu.sctu.zhangwang.month201506.day20150619;

import edu.sctu.zhuyingzhi.month201505.day20150522.ioTest.PrintStream;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created by Administrator on 2015/6/19.
 */
public class SingleServer extends JFrame implements ActionListener{

    @Override
    public void actionPerformed(ActionEvent e) {

    }
    JLabel jL1;
    JButton jB1;
    JTextField jF1;
    JTextArea jT1;
    ServerSocket server;
    Socket socket;
    BufferedReader cin;
    PrintStream cout;
    public SingleServer(){
        super("简单的聊天系统/服务器端");
        jL1 = new JLabel("监听端口");
        jL1.setBounds(15,5,60,30);
        jF1 = new JTextField("6544",15);
        jF1.setBounds(85,5,100,30);
        jB1 = new JButton("开始监听");
        jB1.setBounds(200,5,100,30);
        jB1.addActionListener(this);
        jT1 = new JTextArea();
        JScrollPane jS = new JScrollPane(jT1);
        jS.setBounds(15,45,310,160);
        Container w1Container = this.getContentPane();
        w1Container.setLayout(null);
        w1Container.add(jL1);
        w1Container.add(jF1);
        w1Container.add(jB1);
        w1Container.add(jS);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        SingleServer w1 = new SingleServer();
    }
//    public void actionPerformed(ActionEvent e){   //系统监听
//        try {
//            /*打开服务器端口*/
//            server = new ServerSocket(Integer.parseInt(jF1.getText()));
//            /*添加提示信息*/
//            jT1.append("系统提示：聊天服务系统考试启动。。。。、\n");
//        } catch (IOException e1) {//
//            e1.printStackTrace();
//        }
//    }
}
